<template>
  <div>
    <div>--------------------</div>
    <div>子组件</div>
    <div>父组件props传来的值 ： {{ propsData }}</div>
    <a-input
      placeholder="利用事件传给父组件"
      v-model="emitData"
      style="width:20%"
    />
    <slot>567</slot>
    <slot name="aaa" childVal="子组件值"> 567</slot>
  </div>
</template>

<script>
export default {
  name: "child",
  props: {
    propsData: {
      type: String
    }
  },
  data() {
    return {
      emitData: "利用事件给父组件"
    };
  },
  watch: {
    emitData(newVal) {
      this.$emit("toParent", newVal);
    }
  },
  mounted() {
    this.$emit("toParent", this.emitData);
  },
  methods: {}
};
</script>

<style></style>
